/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Database;

import Model.Dokumen;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

public class UserDokumenTable extends AbstractTableModel {

    private String columns[] = {"No Dokumen", "Perihal", "Asal Dokumen", "Penerima Dokumen", "Id Penerima", "Letak Dokumen", 
        "Petugas Terima", "Tanggal Terima", "Terima"};
    private ArrayList<Dokumen> datadokumen;

    public UserDokumenTable() {
    }

    public UserDokumenTable(ArrayList<Dokumen> datadokumen) {
        this.datadokumen = datadokumen;
    }

    @Override
    public int getRowCount() {
        return getDataDokumen().size();
    }

    public String getColumns(int col) {
        return columns[col];
    }

    @Override
    public int getColumnCount() {
        return columns.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Dokumen dokumen = getDataDokumen().get(rowIndex);
        if (columnIndex == 0) {
            return dokumen.getNomor_dokumen();
        } else if (columnIndex == 1){
            return dokumen.getPerihal();
        } else if (columnIndex == 2){
            return dokumen.getAsal_dokumen();
        } else if (columnIndex == 3){
            return dokumen.getPenerima_dokumen();
        } else if (columnIndex == 4){
            return dokumen.getId_penerima();
        } else if (columnIndex == 5){
            return dokumen.getLetak_dokumen();
        } else if (columnIndex == 6){
            return dokumen.getPetugas_penerima();
        } else if (columnIndex == 7){
            return dokumen.getTanggal_terima();
        } else {
            return dokumen.getTerima();
        }
    }

    public ArrayList<Dokumen> getDataDokumen() {
        return datadokumen;
    }

    public void setDataDokumen(ArrayList<Dokumen> datadokumen) {
        this.datadokumen = datadokumen;
    }
}
